package com.kolon.business.main.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.kolon.business.main.dao.MainDao;
import com.kolon.framework.constant.Constant;
import com.kolon.framework.interfaces.SimpleController;
import com.kolon.framework.util.DateUtil;

@Controller("com.kolon.business.main.controller.ServLogController")
public class ServLogController implements SimpleController {
	
	@Resource(name="MainDaoImpl")
	private MainDao mainDao;
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value="/business/main/servLog.do")
	public ModelAndView controller(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		// 회원 세션 정보
		HttpSession httpSession = request.getSession();
		Map userMap = (Map)httpSession.getAttribute(Constant.SESSION_USER_INFO);
		String servNo = request.getParameter("servNo");
		userMap.put("servNo", servNo);
		userMap.put("connDate", DateUtil.getYearStr()+DateUtil.getMonthStr());
		// 로그 등록
		mainDao.insertServLog(userMap);
		// 리턴
		return null;
	}

}
